All Questions
36 questions
2votes
3answers
1kviews
Find the 'n' most frequent words in a text, aka word frequency
I'm doing freeCodeCamp's Coding Interview Prep to improve my JavaScript skills. This challenge is called "Word Frequency", and is based on the Rosetta Code's entry of the same name. The ...
10votes
4answers
3kviews
First non-repeating Character, with a single loop in Python
I recently tried to solve the first non-repeating character problem. Please tell me if my solution is valid. I'm aiming for O(n) with a single loop. My thinking is, it would be easy to tell you what ...
6votes
1answer
651views
LeetCode 1638: Count Substrings That Differ by One Character
I'm posting a solution for LeetCode's "Count Substrings That Differ by One Character". If you'd like to review, please do. Thank you! Problem Given two strings s and t, find the number of ...
4votes
1answer
227views
Determining whether a string is transformable into another by repetitively increasing its prefixes alphabetically
Here's Alice and Strings, a programming challenge on hackerearth: Two strings \$A\$ and \$B\$ comprising of lower case English letters are compatible if they are equal or can be made equal by ...
2votes
0answers
288views
Split a string into valid words
I am trying to solve this LeetCode question: Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is ...
5votes
4answers
1kviews
Confirm the ending of a string
Challenge: Check if a string (first argument, str) ends with the given target string (second argument, target). This ...
5votes
2answers
313views
1vote
1answer
5kviews
String Rotation
I have solved a previous year question of 2018 codevita (link) in Python. Problem Description: Rotate a given String in the specified direction by specified magnitude. After each rotation make a ...
3votes
1answer
1kviews
Shortest way to form a string out of a subsequence of a string
The task is taken from LeetCode (subscription required) - From any string, we can form a subsequence of that string by deleting some number of characters (possibly no deletions). Given two strings ...
3votes
2answers
590views
Find the longest sub string of a word after concatenation of given words array
An Array of N words is given. Each word consists of small letters ('a'-'z'). Our goal is to concatenate the words in such a way as to obtain a single word with longest possible substring composed of ...
1vote
1answer
499views
Reinterpreting a string, treating < as a backspace character
I've come up with a solution to this coding challenge using recursion. In summary, the input is a string where the < symbol represents a backspace (up to 1 ...
1vote
1answer
999views
The Substring Game! challenge
This is the Substring Game! challenge from HackerEarth: Watson gives Sherlock a string (let's denote it by S). Watson calculates all the substrings of S in his favourite order. According to the ...
5votes
2answers
5kviews
Longest common prefix
I have made a function for finding the longest common prefix for the challenge on the leetcode site. This is the code: ...
5votes
4answers
5kviews
Cracking the Coding Interview: "Problem 1.5. One Away"
I am going one-by-one through problems in the "Cracking the Coding Interview". This question is about problem 1.5. One Away. Since I was never good in "algorithming", any suggestions are highly ...
3votes
1answer
4kviews
Strings: Making Anagrams
Problem Statement Input Format The first line contains a single string, a. The second line contains a single string, b. Constraints 1<= |a|,|b| <= 10^4 It is guaranteed that and consist of ...